import Vue from "vue";
import VueRouter from "vue-router";
import Home from "../views/Home.vue";
import Mine from "../views/Mine.vue";
import Classify from "../views/Classify.vue";

Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    name: "Home",
    component: Home,
    meta: {
      title: "主页",
      islogin: true,
    },
  },
  {
    path: "/classify",
    name: "classify",
    component: Classify,
    meta: {
      title: "分类",
      islogin: true,
    },
  },
  {
    path: "/mine",
    name: "mine",
    component: Mine,
    meta: {
      title: "我的",
      islogin: true,
    },
  },
  {
    path: "/shoppingcart",
    name: "shoppingcart",
    component: () => import("../views/ShoppingCart.vue"),
    meta: {
      title: "购物车",
      islogin: true,
    },
  },
  {
    path: "/login",
    name: "login",
    component: () => import("../components/Login.vue"),
    meta: {
      title: "登录",
      // islogin: true,
    },
  },
  {
    path: "/register",
    name: "register",
    component: () => import("../components/Register.vue"),
    meta: {
      title: "注册",
      islogin: true,
    },
  },
  {
    path: "/nologin",
    name: "nologin",
    component: () => import("../views/Nologin.vue"),
    meta: {
      title: "尚未登录",
      islogin: true,
    },
  },
  {
    path: "/detail/:id",
    name: "detail",
    component: () => import("../views/Detail.vue"),
    meta: {
      title: "商品详情",
    },
  },
  {
    path: "/search",
    name: "search",
    component: () => import("../views/Search.vue"),
    meta: {
      title: "搜索",
    },
  },
  {
    path: "/searchto",
    name: "searchto",
    component: () => import("../components/Searchto.vue"),
    meta: {
      title: "搜索",
    },
  },
  {
    path: "/order",
    name: "order",
    component: () => import("../views/order.vue"),
    meta: {
      title: "填写地址",
    },
  },
  {
    path: "/buy",
    name: "buy",
    component: () => import("../views/buy.vue"),
    meta: {
      title: "买它",
    },
  },

  {
    path: "/live",
    name: "live",
    component: () => import("../views/Live.vue"),
    meta: {
      title: "直播",
    },
  },
  {
    path: "/map",
    name: "map ",
    component: () => import("../views/Map.vue"),
    meta: {
      title: "地图",
    },
  },

  {
    path: "/changeadd",
    name: "changeadd",
    component: () => import("../views/changeadd.vue"),
    meta: {
      title: "买它",
    },
  },
];

const router = new VueRouter({
  routes,
});

export default router;
